﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
using entity;
using Newtonsoft.Json;
public partial class product00 : Basic
{
    public string MTnews = string.Empty;
    public string ProductNews = "暂无产品动态";
    string title = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            MTnews = sb_媒体聚焦().ToString();
            ProductNews = sb_产品动态().ToString();

        }
    }
    public string getUrl
    {
        get
        {
            return "http://kefu.emoney.cn/";
        }
    }

    public StringBuilder sb_媒体聚焦()
    {
        StringBuilder sb = new StringBuilder();
        string str_mtjj = UrlGet.Get("news/NewsListMany.ashx?typeid=1101&top=8");
        if (string.IsNullOrEmpty(str_mtjj))
        {
            sb.AppendLine("<li>--暂无数据--</li>");
            return sb;
        }
        var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewsList>>(str_mtjj);
        foreach (var item in list)
        {
            foreach (var m in item.list)
            {
                // 0501
                title = m.Title;
                if (!string.IsNullOrEmpty(title))
                {
                    if (title.Length > 16)
                    {
                        title = title.Substring(0, 16) + "...";
                    }
                }
                sb.AppendLine("<li style=\"overflow:hidden; height:24px;\"> ·<a href=\"" + m.Url + "\" target=\"_blank\">" + title + "</a></li>");
            }

        }
        return sb;
    }

    // 0404
    public StringBuilder sb_产品动态()
    {
        StringBuilder sb = new StringBuilder();
        string str_cpdt = UrlGet.Get("news/NewsListMany.ashx?typeid=0404&top=7");
        sb.AppendLine("<ul>");
        if (string.IsNullOrEmpty(str_cpdt))
        {
            sb.AppendLine("<li>暂无产品动态信息 </li>");
            sb.AppendLine("</ul>");
            return sb;
        }
        #region 产品动态信息列表
        var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewsList>>(str_cpdt);
        foreach (var item in list)
        {

            for (int i = 0; i < item.list.Length; i++)
            {
                title = item.list[i].Title;
                if (!string.IsNullOrEmpty(title))
                {
                    if (title.Length > 16)
                    {
                        title = title.Substring(0, 16) + "...";
                    }
                }

                sb.AppendLine("<li style=\"overflow:hidden; height:22px;\"> ·<a href=\"" + GetNewsUrl("15", "0404", item.list[i].Id) + "\">" + title + "</a> </li>");

            }

        }
        #endregion

        sb.AppendLine("</ul>");
        return sb;
    }


    /// <summary>
    /// 名师解盘
    /// </summary>
    class MSJPEnty
    {
        public string name { get; set; }

        public List<MsjpLstEnty> lst { get; set; }
    }


    class MsjpLstEnty
    {
        /// <summary>
        /// 主键
        /// </summary>
        public long? Id
        {
            get;
            set;
        }

        /// <summary>
        /// 标题
        /// </summary>
        public string Title
        {
            get;
            set;
        }

        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime? PTime
        {
            get;
            set;
        }

        /// <summary>
        /// 关键字
        /// </summary>
        public string KeyWord
        {
            get;
            set;
        }

        /// <summary>
        /// 内容
        /// </summary>
        public string Content
        {
            get;
            set;
        }

        /// <summary>
        /// 作者
        /// </summary>
        public string Author
        {
            get;
            set;
        }

        /// <summary>
        /// 相关股票
        /// </summary>
        public string Stcok
        {
            get;
            set;
        }

        /// <summary>
        /// 来源
        /// </summary>
        public string Source
        {
            get;
            set;
        }

        /// <summary>
        /// 摘要
        /// </summary>
        public string Summary
        {
            get;
            set;
        }

        /// <summary>
        /// Url
        /// </summary>
        public string Url
        {
            get;
            set;
        }

    }

}